#ifndef GIT2UPDATER_H
#define GIT2UPDATER_H

#include <QObject>
#include <git2.h>
#include <QVariantMap>

class Git2Updater : public QObject
{
    Q_OBJECT
public:
    explicit Git2Updater(QObject *parent = nullptr);
    ~Git2Updater();


public slots:
    void init();
    void startUpdate();
    void getLatestVersionInfo();

signals:
    void updateProgress(int progress);
    void response(bool success, const QVariantMap &details);//message

private:
    void fetchRepository(const QString &path);
    void resetToRemote(const QString &path);
    void fetchLatestTagInfo(git_repository *repo);
    bool openRepository(const QString &path, git_repository **repo);//
    bool lookupRemote(git_repository *repo, git_remote **remote);
    void reportError(const git_error *e);

    QString repoPath = "/home/ASuser/master"; // 修改为你的仓库路径
};

#endif // GITUPDATER_H
